<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script type="text/javascript">
			var fun=function(){
				var r=Math.floor(Math.random()*256);
				var g=Math.floor(Math.random()*256);
				var b=Math.floor(Math.random()*256);
				var color="rgb("+r+","+g+","+b+")";
				document.querySelector("body").setAttribute("style","background-color: "+color+";");
				document.querySelector("span").innerHTML=color;
			}
		</script>
	</head>
	<body>
		<button type="button" onclick="fun()">随机背景色</button>
		<span>rgb(255,255,255)</span>
	</body>
</html>
